package com.cy.controller;

import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/provider/")
public class RestProviderController {

    @PutMapping
    public HashMap<String, Object> doUpdate(@RequestBody Map<String, Object> map) {
        System.out.println("provider.map = " + map);
        HashMap<String, Object> responseMap = new HashMap<>();
        responseMap.put("state", "200");
        responseMap.put("message", "update ok");
        return responseMap;
    }

    @PostMapping
    public HashMap<String, Object> doCreate(@RequestBody Map<String, Object> map) {
        System.out.println("provider.map = " + map);
        HashMap<String, Object> responseMap = new HashMap<>();
        responseMap.put("state", "200");
        responseMap.put("message", "insert ok");
        return responseMap;
    }

    @DeleteMapping("{id}")
    public String doDeleteById(@PathVariable Long id) {
        System.out.println("provider.id="+id);
        return id +" is deleted";

    }
}
